<template>
  <div class="custom-table">
    <!-- 顶部操作区 -->
    <div class="table-operations">
      <el-button type="primary" icon="el-icon-plus" @click="handleAdd">
        新建活动
      </el-button>
      <el-input
        v-model="searchQuery"
        placeholder="搜索..."
        prefix-icon="el-icon-search"
        style="width: 200px; margin-left: auto;"
      />
    </div>

    <!-- 表格 -->
    <el-table
      :data="tableData"
      style="width: 100%"
      :header-cell-style="{background:'#fafafa'}"
    >
      <el-table-column prop="id" label="通知ID" width="100" />
      <el-table-column prop="title" label="活动名称" />
      <el-table-column prop="startTime" label="开始时间" width="180" />
      <el-table-column prop="endTime" label="结束时间" width="180" />
      <el-table-column prop="location" label="活动地点" />
      <el-table-column prop="description" label="活动描述" />
      <el-table-column prop="organizer" label="组织者姓名" />
      
      <el-table-column label="操作" width="200" class-name="operation-column">
        <template slot-scope="scope">
          <el-button 
            size="small" 
            type="primary"
            @click="handleEdit(scope.row)"
          >
            编辑
          </el-button>
          <el-button
            size="small"
            type="danger"
            @click="handleDelete(scope.row)"
          >
            删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <!-- 分页 -->
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[10, 20, 30, 50]"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
    />
  </div>
</template>

<style lang="scss" scoped>
.table-operations {
  margin-bottom: 20px;
  display: flex;
  align-items: center;

  .el-button {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 20px;
    
    i {
      font-size: 16px;
    }
  }
}

// 引入通用表格样式
@import '@/assets/styles/table.scss';
</style> 